<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	Object newProcessFlag = request.getSession().getAttribute("newProcessFlag");
%>

<script type="text/javascript">
	 	
	
		var interval_process;  //定时器
				         
		    
		     //定时器标记
		     var  startFlag= "<%=newProcessFlag%>"+""; 
		     if(startFlag!=null&&startFlag=="true"){   //如果标记为开启
		    	 run(); //加载页面时启动定时器  
		     }else{    //如果标记为关闭
		    		//定时器按钮显示关闭效果
		    		 clearTimeout(interval_process);
					$("#processInfo_timeOutControll").attr("class", "delete");
					$("#processInfo_timeOutControll").find('span').text('已关闭定时器');
		     }
			
			 function run() {
				clearTimeout(interval_process);
				interval_process = setInterval(chatNew, "60000");
			 }
				
		
		//定时器执行内容
		function chatNew() {
			
			if(startFlag!=null&&startFlag=="true"){
				$.ajax({
					type:'post',
					url:'<%=basePath%>ifNewProcessIncome',
					success : function(data) {
						if (data == 'true') { //弹出提示框
							alertMsg.correct('有新的提取信息，请确认！');
						} else if (data == 'false') { 
							
						}
					}
				});
			}else{
				clearTimeout(interval_process);  //取消定时器
			}
		}

		//定时器开关
		function timeOutControll(obj) {
			if ($(obj).attr("class") == "add") {//关闭定时器  
				clearTimeout(interval_process);
				$(obj).attr("class", "delete");
				$(obj).find('span').text('已关闭定时器');
			} else if ($(obj).attr("class") == "delete") { //开启定时器  
				interval_process = setInterval(chat, "30000");
				$(obj).attr("class", "add");
				$(obj).find('span').text('已开启定时器');
			}
		}
		
	</script> 

<c:if test="${code==1}">
	<form id="pagerForm" method="post" action="processInfoAction.action?toResult=searchProcessInfo&rightId=${rightId}">
		<input type="hidden" name="pageNum" value="${page.currentPage }" /> 
		<input type="hidden" name="pageSize" value="${page.pageSize }" />
		<input type="hidden" name="courierTelephone" value="${courierTelephone}" />
		<input type="hidden" name="processType" value="${processType}" />
	</form>

	<form onsubmit="return navTabSearch(this);" action="processInfoAction.action?toResult=searchProcessInfo&rightId=${rightId}" method="post">
		<div class="pageHeader">
			<input type="hidden" name="init" value=0>
			<div class="searchBar">
					<table class="searchContent">

						<tr>
						<td>基础单号: <input type="text" name="baseOrderNo" style="width:100px;" value="${baseOrderNo}"/>
							</td>
												
						<td>快递员电话: <input type="text" name="courierTelephone" value="${courierTelephone}" style="width:100px;"/>
						</td>
						
					<td>是否处理: 
						<select name="processType" id="processType_id">
						<option  value="-1" <s:if test="#request.processType==0">selected="selected"</s:if> >全部</option>
						<option  value="0" <s:if test="#request.processType==1">selected="selected"</s:if> >提现</option>
						</select>
					</td>
										
						<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
							<td>
								<div class="buttonActive">
									<div class="buttonContent">
										<button type="submit">检索</button>
									</div>
								</div>
							</td>
						</tr>
					</table>
				</div>
			
		</div>
		<div class="pageContent">
			<div class="panelBar">
				<ul class="toolBar">
					<c:forEach items="${righSubtList}" var="rightsub">
	
						<!-- 确认 -->
						<c:if test="${fn:contains(rightsub.rightValue,'checkProcessInfo')}">
							<li><a class="edit" href="${rightsub.rightValue}&supportID={sid_support}&rightId=${rightId}" target="navTab" ><span>${rightsub.rightName}</span> </a></li>
							<li class="line">line</li>
						</c:if>
					</c:forEach>
					<li><a id="processInfo_timeOutControll" class="add" href="javascript:void(0)" onclick="timeOutControll(this)"><span>已开启定时器</span> </a></li>
				</ul>
			</div>
			<table class="list" width="100%" layoutH="158">
				<thead>
					<tr>
						<th align="center">序号</th>
						<th align="center">流水号</th>
						<th align="center">快递员名称</th>
						<th align="center">流水类型</th>
						<th align="center">流水状态</th>
						<th align="center">处理金额</th>
						<th align="center">余额</th>
						<th align="center">详情</th>
						<th align="center">基础订单号</th>
						<th align="center">处理时间</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator var="processInfo" value="page.data" status="st">
						<tr target="sid_support" rel="<s:property value="#processInfo.id" />">
							<th width="1%" align="center"><s:property value="page.pageSize * (page.currentPage-1) + #st.index + 1" /></th>
							<th width="4%" align="center"><s:property value="#processInfo.serialNumber" /></th>
							<th width="3%" align="center"><s:property value="#processInfo.courierName" /></th>
							<th width="3%" align="center">
							<s:if test="#request.processInfo.processType==0">
								<span style="color:red">提现</span>	</s:if>
							<s:elseif test="#request.processInfo.processType==1">
								<span style="color: blue">转入</span></s:elseif>	
							<s:elseif test="#request.processInfo.processType==2">
								<span style="color: red">系统扣款</span></s:elseif>	
							<s:elseif test="#request.processInfo.processType==3">
								<span style="color: blue">系统返还</span></s:elseif>
							<s:elseif test="#request.processInfo.processType==4">
								<span style="color: blue">时效奖励</span></s:elseif>
							<s:elseif test="#request.processInfo.processType==5">
								<span style="color: blue">订单奖励</span></s:elseif>
							<s:elseif test="#request.processInfo.processType==6">
								<span style="color: blue">公司提成</span></s:elseif>	
							<s:elseif test="#request.processInfo.processType==7">
								<span style="color: red">订单发货费</span></s:elseif>	
							</th>
							<th width="3%" align="center">
							<s:if test="#request.processInfo.processStatus==0">
								<span>处理中</span>	</s:if>
							<s:elseif test="#request.processInfo.processStatus==1">
								<span style="color: red">失败</span></s:elseif>	
							<s:elseif test="#request.processInfo.processStatus==2">
								<span style="color: blue">成功</span></s:elseif>	
							</th>
							<th width="2%" align="center"><s:property value="#processInfo.dealMoney" /></th>
							<th width="2%" align="center"><s:property value="#processInfo.balance" /></th>
							<th width="10%" align="center"><s:property value="#processInfo.detail" /></th>
							<th width="3%" align="center"><s:property value="#processInfo.baseOrderNo" /></th>
							<th width="5%" align="center"><s:date name="#processInfo.motifyTime" format="yyyy-MM-dd HH:mm:ss" /></th>
						</tr>
					</s:iterator>
				</tbody>
			</table>
			<div class="panelBar">
				<div class="pages">
					<span>共${page.totalNum }条，共${page.totalPage }页</span>
				</div>
				<div class="pagination" targetType="navTab" totalCount="${page.totalNum }" numPerPage="${page.pageSize }" pageNumShown="10" currentPage="${page.currentPage }"></div>
			</div>
		</div>
	</form>
</c:if>
<c:if test="${code==0}">
	${message}
</c:if>